<template>
  <div class="enterprise-detail">
    <back />
    <el-card>
      <template #header>
        <div class="header">
          <div class="header-top">
            <img :src="enterpriseInfo.businessLicense" class="businessLicense" alt="企业营业执照" />
            <div class="header-top-right m-l-10">
              <div class="header-top-right-info">
                <div class="flex">
                  <span>{{ enterpriseInfo.name }}</span>
                </div>
                <div class="m-t-10">
                  <span class="color-gray">法定代表人：</span>
                  <span>{{ enterpriseInfo.representative }}</span>
                </div>
              </div>
            </div>
          </div>
          <div class="header-footer">
            <div>
              <span class="color-gray">注册地址：</span>
              <span>{{ enterpriseInfo.registeredAddress }}</span>
            </div>
            <div>
              <span class="color-gray">注册资金：</span>
              <span>{{ enterpriseInfo.registeredCapital }}万</span>
            </div>
            <div>
              <span class="color-gray">联系方式：</span>
              <span>{{ enterpriseInfo.telephone }}</span>
            </div>
            <div>
              <span class="color-gray">邮箱：</span>
              <span>{{ enterpriseInfo.mail }}</span>
            </div>
            <div>
              <span class="color-gray">企业类型：</span>
              <span>{{ enterpriseInfo.type }}</span>
            </div>
            <div>
              <span class="color-gray">注册时间：</span>
              <span>{{ enterpriseInfo.establishmentTime }}</span>
            </div>
          </div>
        </div>
      </template>
      <div v-html="enterpriseInfo.briefIntroduction" class="wang-editor-html"></div>
    </el-card>
  </div>
</template>

<script setup lang="ts">
import { enterpriseDetail } from '@/api/enterpeise';
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
import back from '@/components/back/index.vue';

const route = useRoute();
const enterpriseInfo = ref<any>({});
onMounted(() => {
  const id = Number(route.query.id as string);
  enterpriseDetail(id).then((res: any) => {
    console.log(res);
    if (res.code === 200) {
      enterpriseInfo.value = res.data;
    }
  });
});
</script>

<style lang="scss" scoped>
.enterprise-detail {
  padding: 20px 100px;
  .header {
    padding: 0 20px;
    &-top {
      display: flex;
      .businessLicense {
        width: 60px;
        height: 60px;
        object-fit: cover;
      }
      &-right {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
      }
    }
    &-footer {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      div {
        width: 48%;
        margin-top: 15px;
      }
    }
  }
}
</style>
